package com.xtweb.controller;

import com.jfinal.core.Controller;
import com.xtweb.model.Pt_MsgBox;

public class MsgBox extends Controller{
	
	public void index(){
		String sql = "FROM PT_MSGBOX WHERE 1=1 ORDER BY STATUS ASC , IDS DESC";
		
		setAttr("msgBoxList", Pt_MsgBox.dao.paginate(1, 3, "SELECT * ", sql));
		render("/msgbox/msgbox.html");
		
		getMagBoxDetailById();
		
	}
	
	
	public void getMagBoxDetailById() {
		String  ids = getPara(0);
		if(ids==null)
		{
			return;	
		}	
		String sql = "SELECT * FROM PT_MSGBOX WHERE IDS = ?";
		Pt_MsgBox msgBox = 	Pt_MsgBox.dao.findFirst(sql, ids);
		
		
		setAttr("msgBox", msgBox);
		render("/msgbox/msgbox.html");
	}

	
	public void nextPage(){
		int pageNum = getParaToInt("pageNum",1);
		String sql = "FROM PT_MSGBOX WHERE 1=1 ORDER BY STATUS ASC , IDS DESC";
		
		setAttr("msgBoxList", Pt_MsgBox.dao.paginate(pageNum, 3, "SELECT * ", sql));
		render("/msgbox/msgboxlist.html");
		
	}
}